Из наиболее значимого в go 1.14 внесли изменения в спецификацию языка, а именно, теперь разрешается встраивать интерфейсы с пересекающимися наборами методов.
Возвращаясь к реальной жизни давайте разберем пример типичного интерфейса:
package user
type Database interface { GetUser(userID uint64) (model.User, error) }
И допустим у меня есть несколько других пакетов, из которые я тоже хочу доставать информацию о пользователе, поэтому нам необходимо встроить интерфейс user.Database в hardware.Database и тоже самое для wallet.Database:
type Database interface { user.Database ReadWallet(userID uint64) (model.Wallet, error) }
Ну и классика жанра, прилетает задача где нужно создать интерфейс shopping.Database который должен в себе содержать методы hardware.Database и wallet.Database:
И в go версии меньше чем go 1.14 мы получим ошибку: Duplicate method GetUser(userID uint64) (model.User, error) Если запустить go1.14rc1 run main.go то все будет ок 🎉
P.S. эта проблема была еще озвучена Алоном Донованом в 2013 году!!! [1]
Из наиболее значимого в go 1.14 внесли изменения в спецификацию языка, а именно, теперь разрешается встраивать интерфейсы с пересекающимися наборами методов.
Возвращаясь к реальной жизни давайте разберем пример типичного интерфейса:
package user
type Database interface { GetUser(userID uint64) (model.User, error) }
И допустим у меня есть несколько других пакетов, из которые я тоже хочу доставать информацию о пользователе, поэтому нам необходимо встроить интерфейс user.Database в hardware.Database и тоже самое для wallet.Database:
type Database interface { user.Database ReadWallet(userID uint64) (model.Wallet, error) }
Ну и классика жанра, прилетает задача где нужно создать интерфейс shopping.Database который должен в себе содержать методы hardware.Database и wallet.Database:
И в go версии меньше чем go 1.14 мы получим ошибку: Duplicate method GetUser(userID uint64) (model.User, error) Если запустить go1.14rc1 run main.go то все будет ок 🎉
P.S. эта проблема была еще озвучена Алоном Донованом в 2013 году!!! [1]
Telegram auto-delete message, expiring invites, and more
elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.
NEWS: Telegram supports Facetime video calls NOW!
Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another option—secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secure—like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.